/**
 * 
 */
package org.hehui.supervisorysystem.ui;

import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.StatusLineLayoutData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.hehui.supervisorysystem.util.CacheImage;
import org.hehui.supervisorysystem.util.IAppConstants;
import org.hehui.supervisorysystem.util.IImageKey;


/**
 * @author 贺辉
 *
 */
public class StatusBarContributionItem extends ContributionItem {
	private String message;
	
	/**
	 * 
	 */
	public StatusBarContributionItem() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param id
	 */
	public StatusBarContributionItem(String msg) {
		message = msg;
	}


	@Override
	public void fill(Composite parent) {

		Label separator = new Label(parent,SWT.SEPARATOR);
		//布局数据类
		StatusLineLayoutData statusLineLayoutData = new StatusLineLayoutData();
		statusLineLayoutData.heightHint = 20;
		separator.setLayoutData(statusLineLayoutData);
		//显示文字标签
		CLabel statusCLabel = new CLabel(parent,SWT.SHADOW_NONE);
		statusLineLayoutData.widthHint = 100;
		statusCLabel.setLayoutData(statusLineLayoutData);
		
		statusCLabel.setText(message);
		statusCLabel.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.USER_NAME));
		
	}
	
	

}
